package com.lyc.common.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author 李大神仙
 * @Date 2024/3/18 20:34
 * @Version 1.0
 */
public enum DepartProcessStatusEnum {
    REVOKE_DRAFT("100","草稿","REVOKE_DRAFT"),
    PROCESS("101","待审","PROCESS");

    String departCode;
    String departDesc;
    String departText;

    DepartProcessStatusEnum(String departCode, String departDesc, String departText) {
        this.departCode = departCode;
        this.departDesc = departDesc;
        this.departText = departText;
    }

    public String getDepartCode() {
        return departCode;
    }

    public String getDepartDesc() {
        return departDesc;
    }

    public String getDepartText() {
        return departText;
    }

    private static Map<String,String> zyMap = new HashMap<>();
    //请求该枚举时首先调用一次
    static {
        for (DepartProcessStatusEnum value : DepartProcessStatusEnum.values()){
            zyMap.put(value.getDepartCode(),value.getDepartText());
        }
    }

    /**
     * 从map跟着code取departText
     * @param code
     * @return
     */
    public static String getDepartText(String code){
        return zyMap.get(code);
    }
}
